import { NestFactory } from '@nestjs/core';
import { ValidationPipe } from '@nestjs/common';
import { AppModule } from './app.module';
import { generateDocument } from './doc';
import { NestExpressApplication } from '@nestjs/platform-express';

async function bootstrap() {
  const app = await NestFactory.create<NestExpressApplication>(AppModule);
  app.useStaticAssets('public')
  app.setGlobalPrefix('api');
  app.useGlobalPipes(new ValidationPipe({
    stopAtFirstError: true
  }))
  // 创建swagger文档
  generateDocument(app);
  app.enableCors()
  await app.listen(3000);
}
bootstrap();
